package com.andnnl.http;

import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;

/**
 * Created by chenss on 2021/5/24.
 */
public class HttpTest {
    public static void main(String[] args) {
//        String url = "http://localhost:8010//getNextIpBean";
        String url = "http://192.168.4.124:8010//getNextIpBean";
        String key="22222222222";
        if (key != null) {
            url += "/" + key;
        }
        test1(url);


    }

    private static void test1(String url) {
        String result = HttpRequest.get(url)
                .setConnectionTimeout(3000)
                .setReadTimeout(3000)
//                .contentType("text/html; charset=utf-8")
                .header(Header.ACCEPT,"text/html")
//                .header(Header.CONTENT_TYPE,"application/json; charset=utf-8")
                .setFollowRedirects(true)
                .execute().body();
        System.out.println(("getNextIpBean url:" + url + " rs:" + result));
    }
}
